package com.niit.TopN.SchoolTop10;



import java.util.Iterator;
import org.apache.hadoop.io.Text;
import com.niit.bean.SchoolTop100Bean;
import org.apache.hadoop.mapreduce.Reducer;
import java.io.IOException;

public class SchoolTop100Reducer extends Reducer<SchoolTop100Bean,Text,Text, SchoolTop100Bean> {
    private int num = 0;

    @Override
    protected void reduce(SchoolTop100Bean key, Iterable<Text> values, Context context) throws IOException, InterruptedException {
        Iterator<Text> iterator = values.iterator();
        while (iterator.hasNext() && num < 100) {
            Text outKey = iterator.next();
            context.write(outKey, key);
            num++;
        }
    }
    }


